package string

import (
	"math/rand"
	"time"
)

// RandomString 生成随机数
func RandomString(charTable string, length int) string {
	tabs := []byte(charTable)
	result := []byte{}
	r := rand.New(rand.NewSource(time.Now().UnixNano()))
	for i := 0; i < length; i++ {
		result = append(result, tabs[r.Intn(len(tabs))])
	}
	return string(result)
}
